---玫丽技能2 第一段
---闪现到目标旁
---@class SkillEffect144100:BaseSkillEffect
SkillEffect144100 = ClientFight.CreateClass("SkillEffect144100",ClientFight.BaseSkillEffect)
local t = SkillEffect144100
t.SKILL_EFFECT_14410_OLD_POS = "SKILL_EFFECT_14410_OLD_POS"
---@param skill FightUsingSkill
function t:releaseSkill(skill)
    local fight = skill.fight
    local fighter = skill.fighter
    local oldPos = Vector2(fighter.position.x,fighter.position.y);
    -- 被援护者
    local target = skill.target

    local skillBean = skill.skill.skillBean;
    local scriptParames = skillBean.f_SkillScriptParameter

    -- 前摇阶段
    skill.stage = FightSkillStageEnum.PREPARE

    skill.separate = skillBean.f_SkillOut == 1
    local yOffset = 1.0;--//Utils.toRatio(scriptParames[1]);
    local xOffset = Utils.toRatio(scriptParames[1]);
    local selfX = fighter.position.x
    local selfY = fighter.position.y
    local targetX = target.position.x
    local targetY = target.position.y
    if (targetY - yOffset <= selfY and selfY <= targetY + yOffset and targetX - xOffset <= selfX and selfX <= targetX + xOffset) then
        return false;
    end
    local leftOrRight = FighterUtils.leftOrRight1(target, fighter);

    FighterManager.changePosition(fight, fighter, 0, targetX + leftOrRight * xOffset,targetY, 0, true, true);
    fighter.parametersByObject[t.SKILL_EFFECT_14410_OLD_POS] = oldPos
    SkillRoleMgr.savePathFile( string.format("[%s][EFFECT]Fighter:%s 触发玫丽技能 闪现到目标旁，目标：%s,坐标改变为%s,原坐标%s,目标坐标%s",
    fight.frame, fighter.fighterId, target.fighterId, fighter.position, oldPos,target.position)
    );
    return false;
end
---@param skill FightUsingSkill
function t:finishSkill(skill,breakin)
    local fight = skill.fight
    local fighter = skill.fighter
    local oldPos =  fighter.parametersByObject[t.SKILL_EFFECT_14410_OLD_POS]
    if (oldPos ~= nil) then
        FighterManager.changePosition(fight, fighter, 0, oldPos.x,oldPos.y, 0, true, true);
    end
    SkillRoleMgr.savePathFile( string.format("[%s][EFFECT]Fighter:%s 玫丽技能2 结束回到原来坐标%s",
    fight.frame, fighter.fighterId, fighter.position)
    );
    return false;
end
t.New()